package com.zdp.seckill.controller;

import com.zdp.commons.model.domain.ResultInfo;
import com.zdp.seckill.service.SeckillService;
import com.zdp.seckill.service.TestSeckillService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author sesshomaru
 * @date 2021/6/9
 */
@RestController
public class TestSeckillController {

    @Resource
    private TestSeckillService testSeckillService;

    /**
     * 秒杀下单
     *
     * @param voucherId
     * @param access_token
     * @return
     */
    @PostMapping("/test/{voucherId}")
    public ResultInfo<String> doSeckill(@PathVariable Integer voucherId, String access_token) {
        ResultInfo resultInfo = testSeckillService.doRedisSeckill(access_token, voucherId);
        return resultInfo;
    }
}
